﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>运单信息</title>
    <!--<link href="../../script/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../script/css/bootstrap-table.css" rel="stylesheet" />
    <script src="../../script/js/jquery-1.12.3.js"></script>
    <script src="../../script/js/bootstrap.min.js"></script>
    <script src="../../script/js/bootstrap-table.js"></script>
    <script src="../../script/js/bootstrap-table-zh-CN.js"></script>
    <script src="../../script/js/cus-grid.js"></script>-->
</head>
<body>
    <div style="width:100%">
        <table name="base_order"></table>
    </div>
    <script name="loadPage">
        var base_order_init;

        var base_order = {
            data: {
                data: []
            },
            detailLink: [],
            rowbtns: [],
            toolbtns: [],
            cols: [],
            new: function () {
                base_order_init.editLoad('base_order_edit.html');
            },
            edit: function () {
                base_order_init.editLoad('base_order_edit.html');
            },
            del: function () {
                $.post('/api/base_order/del', { id: base_order_init.getId_edit }, function () {
                    window.location.reload();
                });
            },
            mdel: function () {
                $.post('/api/base_order/mdel', { objs: base_order_init.getSelects() }, function () {
                    window.location.reload();
                });
            },
            check: function () {

            },
            mcheck: function () {

            }
        };

        $(function () {
            base_order.cols = [
{ field: 'code', title: '单号' }
, {
    field: 'barea', title: '发货地', formatter: function (val, row, idx) {
        var str = '';
        for (var i = 0; i < base_order.data['barea'].length; i++) {
            var p = base_order.data['barea'][i];
            if (p.id == val) {
                str = str == '' ? p.text : str + ',' + p.text;
            }
        }
        return str;
    }
}
, {
    field: 'earea', title: '目的地', formatter: function (val, row, idx) {
        var str = '';
        for (var i = 0; i < base_order.data['earea'].length; i++) {
            var p = base_order.data['earea'][i];
            if (p.id == val) {
                str = str == '' ? p.text : str + ',' + p.text;
            }
        }
        return str;
    }
}
, { field: 'thname', title: '提货人' }
, { field: 'thphone', title: '提货人手机' }
, { field: 'weight', title: '重量（吨）', visible: false }
, { field: 'volume', title: '体积（方）', visible: false }
, { field: 'tolvalue', title: '货物总价', visible: false }
, { field: 'remark', title: '说明', visible: false }
, {
    field: 'company1', title: '发货方', visible: false, formatter: function (val, row, idx) {
        var str = '';
        for (var i = 0; i < base_order.data['company1'].length; i++) {
            var p = base_order.data['company1'][i];
            if (p.id == val) {
                str = str == '' ? p.text : str + ',' + p.text;
            }
        }
        return str;
    }
}
, {
    field: 'company2', title: '承运方', visible: false, formatter: function (val, row, idx) {
        var str = '';
        for (var i = 0; i < base_order.data['company2'].length; i++) {
            var p = base_order.data['company2'][i];
            if (p.id == val) {
                str = str == '' ? p.text : str + ',' + p.text;
            }
        }
        return str;
    }
}
, { field: 'yf', title: '运费', visible: false }
, { field: 'bf', title: '保费', visible: false }
, { field: 'tc', title: '提成', visible: false }
, { field: 'yffd', title: '运费返点', visible: false }
, { field: 'bffd', title: '保费返点', visible: false }
, {
    field: 'iflag', title: '状态', visible: false, formatter: function (val, row, idx) {
        var str = '';
        for (var i = 0; i < base_order.data['iflag'].length; i++) {
            var p = base_order.data['iflag'][i];
            if (p.id == val) {
                str = str == '' ? p.text : str + ',' + p.text;
            }
        }
        return str;
    }
}
            ];

            
            base_order.rowbtns.push({
                text: '编辑',
                fn: 'base_order.edit'
            });
            base_order.rowbtns.push({
                text: '删除',
                fn: 'base_order.del'
            });
            base_order.rowbtns.push({
                jstr: '<button class="btn btn-danger" onclick="base_order.check();">审核</button>'
            });

            base_order.toolbtns.push({
                text: '新增',
                fn: 'base_order.new'
            });
            base_order.toolbtns.push({
                text: '删除',
                fn: 'base_order.mdel'
            });
            base_order.toolbtns.push({
                jstr: '<button class="btn btn-danger" onclick="base_order.mcheck();">审核</button>'
            });

            //base_order.detailLink.push({
            //    tablename: 'table2',
            //    parentid: 'name',
            //    caption: 'tname',
            //    isActive: true
            //});

            base_order_init = base_order_init == undefined ? cusGrid() : function () {
                return base_order_init.reCreate();
            }();
            $.get('/api/base_order/get',
null,
                    function (data) {                        
                        base_order.data = data;
                        if (base_order.data.account != "0") {
                            base_order.cols.splice(13, 1);
                        }
                        base_order_init.init({
                            data: base_order.data,
                            detailLink: base_order.detailLink,
                            rowbtns: base_order.rowbtns,
                            toolbtns: base_order.toolbtns,
                            cols: base_order.cols,
                            isSelect: true,
                            tableName: 'base_order'
                        });
                        base_order_init.initTable();
                    });
        })
    </script>



</body>
</html>
